package com.example.restaurant.controller;

import cn.hutool.core.util.IdUtil;
import com.example.restaurant.common.OssTemplate;
import com.example.restaurant.common.Result;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;

@RestController
public class demo {
    @PostMapping("aa")
    public Result addImages() throws FileNotFoundException {
        File file=new File("D:\\imgs\\bear.jpg");
        FileInputStream fileInputStream=new FileInputStream(file);
        String s1 = IdUtil.randomUUID();
        String s = OssTemplate.fileUpload("img/"+s1+".jpg",fileInputStream, "images81");
        return null;
    }
}
